import { SET_USER, CLEAR_USER } from './types';

interface SetUserAction {
    type: typeof SET_USER;
    payload: {
        user: string;
        token: string;
    };
}

interface ClearUserAction {
    type: typeof CLEAR_USER;
}

export const setUser = (user: string, token: string): SetUserAction => ({
    type: SET_USER,
    payload: { user, token }
});

export const clearUser = (): ClearUserAction => ({
    type: CLEAR_USER
});